import {
  createRouter,
  createWebHashHistory,
  type RouteRecordRaw,
} from "vue-router";
import Tool from "../view/Tool.vue";
import LoginPage from "../view/LoginPage.vue";
import Address from "../view/Address.vue";
import Show from "../view/Show.vue";
import Ordel from "../view/Ordel.vue";
//路由表
const routes: RouteRecordRaw[] = [
  {
    path: "/",
    redirect: "/tool/index",
  },
  {
    name: "login",
    path: "/login",
    component: LoginPage,
  },
  {
    name: "ordel",
    path: "/ordel",
    component: Ordel,
  },
  {
    name: "show",
    path: "/show",
    component: Show,
  },
  {
    name: "address",
    path: "/address",
    component: Address,
  },
  {
    name: "tool",
    path: "/tool",
    component: Tool,
    children: [
      {
        path: "/",
        component: Tool,
      },
      {
        name: "index",
        path: "index",
        component: () => import("../view/tool/Index.vue"),
      },
      {
        name: "cate",
        path: "cate",
        component: () => import("../view/tool/Cate.vue"),
      },
      {
        name: "car",
        path: "car",
        component: () => import("../view/tool/Car.vue"),
      },
      {
        name: "my",
        path: "my",
        component: () => import("../view/tool/My.vue"),
      },
    ],
  },
];

//创建路由对象
const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
